package com.thd.framework.web.file.controller;

import com.thd.framework.basic.model.Message;
import com.thd.framework.basic.utils.SimpleExcelUtils;
import com.thd.framework.web.controller.BasicController;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/file")
@Api(value = "文件操作相关")
public class FileController extends BasicController {

    @PostMapping("upload")
    @ResponseBody
    public Message<List<Map<Integer,String>>> upload(MultipartFile file) throws IOException {
        List<Map<Integer,String>> r = SimpleExcelUtils.getData(file.getInputStream(),0,1);
        return Message.success(r);
    }

}
